![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
extend-shallow
Advanced tools
Package description
The extend-shallow npm package is used to copy the properties of one or more source objects to a target object. It is a utility for shallowly extending the properties of objects without deeply cloning them.
Shallow extend one object with another
This feature allows you to extend an object by adding properties from another object. The properties are copied over shallowly, meaning that if the property values are objects, they are not deeply cloned.
{"const extend = require('extend-shallow');
const obj1 = { a: 'a' };
const obj2 = { b: 'b' };
const result = extend(obj1, obj2);
// result is { a: 'a', b: 'b' }"}
Shallow extend with multiple source objects
This feature allows you to extend an object with properties from multiple source objects. The last source's properties will overwrite the properties of the same name in previous sources if they exist.
{"const extend = require('extend-shallow');
const obj1 = { a: 'a' };
const obj2 = { b: 'b' };
const obj3 = { c: 'c' };
const result = extend(obj1, obj2, obj3);
// result is { a: 'a', b: 'b', c: 'c' }"}
The object-assign package is a polyfill for the Object.assign() method, which copies enumerable and own properties from source objects to a target object. It is similar to extend-shallow but is designed to mimic the behavior of the native JavaScript method.
lodash.assign is a method from the Lodash library that assigns own enumerable properties of source objects to the destination object. It is similar to extend-shallow but comes with the additional utility functions provided by Lodash.
deep-extend is similar to extend-shallow but, as the name suggests, performs a deep extend, meaning that it recursively copies property values that are objects, resulting in a deep clone of the source objects' properties.
Readme
Extend an object with the properties of additional objects. node.js/javascript util.
Install with npm
$ npm i extend-shallow --save
var extend = require('extend-shallow');
extend({a: 'b'}, {c: 'd'})
//=> {a: 'b', c: 'd'}
Pass an empty object to shallow clone:
var obj = {};
extend(obj, {a: 'b'}, {c: 'd'})
//=> {a: 'b', c: 'd'}
Object
constructor.Install dev dependencies:
$ npm i -d && npm test
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on June 29, 2015.
FAQs
Extend an object with the properties of additional objects. node.js/javascript util.
The npm package extend-shallow receives a total of 48,301,609 weekly downloads. As such, extend-shallow popularity was classified as popular.
We found that extend-shallow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.